import React, { Component } from 'react';
import { Link,Redirect } from "react-router-dom";
class Index extends Component {
    constructor(props) {
        super(props);
        this.state = {
            list: [
                { id: 123, title: '个人博客-1' },
                { id: 456, title: '个人博客-2' },
                { id: 789, title: '个人博客-3' },
            ]
        }
        // this.props.history.push("/home/");   //重定向
    }
    render() {
        return (
            <ul>
                {
                    this.state.list.map((item, index) => {
                        return (<li key={index}><Link to={'/list/'+item.id}>{item.title}</Link></li>)
                    })
                }
                {/* <Redirect to="/home/" /> */}
            </ul>
        );
    }
}

export default Index;